package com.quizh.euro.shared;

import java.util.ArrayList;
import java.util.List;

import com.googlecode.objectify.annotation.Entity;
import com.googlecode.objectify.annotation.Id;
import com.googlecode.objectify.annotation.Index;
import com.googlecode.objectify.annotation.Unindex;

@Entity
@Unindex
public class Boleto {
	public static final String MASTER = "premiado";
	public static final char STAR = 'S';
	public static final String EMAIL = "email";
	public static final String INDEX = "index";
	public static final String DATE = "date";
	
	@Id
	private Long id;
	@Index
	private String email;
	@Index
	private List<String> index;
	@Index
	private Long date;
	private List<String> num;
	private List<String> star;
	
	public Boleto() {
		
	}
	public Boleto(String email, Long date,
			List<String> num, List<String> star) {
		super();
		this.email = email;
		this.date = date;
		this.num = num;
		this.star = star;
		index = generateIndex();
	}
	
	private List<String> generateIndex() {
		List<String> list = new ArrayList<String>();
		if (num != null) {
			list.addAll(num);	
		}
		if (star != null) {
			for (String value : star) {
				list.add(STAR+value);
			}
		}
		return list;
	}
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public List<String> getIndex() {
		return index;
	}
	public void setIndex(List<String> index) {
		this.index = index;
	}
	public Long getDate() {
		return date;
	}
	public void setDate(Long date) {
		this.date = date;
	}
	public List<String> getNum() {
		return num;
	}
	public void setNum(List<String> num) {
		this.num = num;
		index = generateIndex();
	}
	public List<String> getStar() {
		return star;
	}
	public void setStar(List<String> star) {
		this.star = star;
		index = generateIndex();
	}
	
}
